package cn.com.cifi.mars.service.impl;

import cn.com.cifi.mars.bean.bo.projecyByStages.FullPathOrgData;
import cn.com.cifi.mars.bean.bo.returnCoefficient.ReturnCoefficientMySaleDataBO;
import cn.com.cifi.mars.bean.bo.returnCoefficient.ReturnCoefficientNosSaleDataBO;
import cn.com.cifi.mars.bean.dto.*;
import cn.com.cifi.mars.bean.vo.report.CityReturnCoefficientReportVo;
import cn.com.cifi.mars.bean.vo.report.ReturnCoefficientReportVo;
import cn.com.cifi.mars.common.exception.MsgException;
import cn.com.cifi.mars.constant.*;
import cn.com.cifi.mars.entity.*;
import cn.com.cifi.mars.mapper.mars.*;
import cn.com.cifi.mars.mapper.wrapper.ReturnCoefficientDetailWrapper;
import cn.com.cifi.mars.service.*;
import cn.com.cifi.mars.util.*;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;


/**
 * <p>
 * 城市回款系数 服务实现类
 * </p>
 *
 * @author JingYuanXiang
 * @since 2020-12-16
 */
@Slf4j
@Service
public class DmCityReturnCoefficientServiceImpl extends ServiceImpl<DmCityReturnCoefficientMapper, DmCityReturnCoefficient> implements DmCityReturnCoefficientService {

    @Autowired
    private ReturnCoefficientDetailService returnCoefficientDetailService;
    @Autowired
    private VsMarsGetinzclService vsMarsGetinzclService;
    @Autowired
    private DmOdsNosTradedataviewformarsService dmOdsNosTradedataviewformarsService;
    @Autowired
    private VsNosPayabledataviewformarsService vsNosPayabledataviewformarsService;
    @Autowired
    private DmOdsMyVsMarsSContractService dmOdsMyVsMarsSContractService;
    @Autowired
    private SignPlanVersionService signPlanVersionService;
    @Autowired
    private VsMarsFeeService vsMarsFeeService;
    @Autowired
    private MyConstants myConstants;
    @Autowired
    private DmCityReturnCoefficientMapper dmCityReturnCoefficientMapper;
    @Autowired
    private DmProjectReturnCoefficientMapper dmProjectReturnCoefficientMapper;
    @Autowired
    private ProjectByStagesService projectByStagesService;
    @Autowired
    private ProjectService projectService;

    /**
     * 查询城市实际版回款系数
     *
     * @param yearMonth 归属年月
     * @return
     */
    @Override
    public List<CityReturnCoefficientReportVo> dmCityReturnCoefficient(String yearMonth) {

        if (StringUtils.isEmpty(yearMonth)) {
            throw new MsgException(CodeEnum.REQUEST_PARAM_NOT_FULL_ERROR);
        }
        //城市数据集合
        List<CityReturnCoefficientReportVo> listVo = new ArrayList<>();

        //归属时间
        LocalDateTime time = LocalDateTimeUtils.toLocalDateTime(yearMonth);

        List<DmCityReturnCoefficient> coefficientList = dmProjectReturnCoefficientMapper.selectDmCityReturnCoefficient(time);
        //根据城市分组(key:城市id，value：数据表list)
        Map<String, List<DmCityReturnCoefficient>> cityMap = coefficientList.stream()
                .collect(Collectors.groupingBy(DmCityReturnCoefficient::getCityId));
        Set<Map.Entry<String, List<DmCityReturnCoefficient>>> cityEntries = cityMap.entrySet();
        for (Map.Entry<String, List<DmCityReturnCoefficient>> entry : cityEntries) {
            //城市数据
            CityReturnCoefficientReportVo cityVo = new CityReturnCoefficientReportVo();
            String cityId = entry.getKey();
            List<DmCityReturnCoefficient> cityList = entry.getValue();
            String cityName = null;
            for (DmCityReturnCoefficient dmCityReturnCoefficient : cityList) {
                cityName = dmCityReturnCoefficient.getCityName();
                break;
            }
            cityVo.setCityCode(cityId);
            cityVo.setCityName(cityName);

            //城市业态数据集合
            List<ReturnCoefficientReportVo> reportVoReturnList = new ArrayList<>();

            for (DmCityReturnCoefficient dmCityReturnCoefficient : cityList) {
                //业态数据
                ReturnCoefficientReportVo reportVo = new ReturnCoefficientReportVo();
                String proProductCode = dmCityReturnCoefficient.getProProductCode();
                if (BigStandardFormatsEnum.RESIDENCE.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (BigStandardFormatsEnum.PARKING.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (BigStandardFormatsEnum.OTHER.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (BigStandardFormatsEnum.BUSINESS_VILLA_LIST.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.BUSINESS_VILLA.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.HOTEL.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.LOFT.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.PARKING_SPACE.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.SOHO.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.SINGLE_FAMILY_OFFICE.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.STANDARD_OFFICE.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.UNDERGROUND_STORAGE_ROOM_NON_MOTORIZED_GARAGE.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.ANCILLARY_FACILITY.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.BUSINESS.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.OTHER.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                } else if (StandardFormatsEnum.RESIDENTIAL.getKey().equals(proProductCode)) {
                    reportVo.setDmCityReturnCoefficient(dmCityReturnCoefficient);
                    reportVo.setCode(dmCityReturnCoefficient.getProProductCode());
                    reportVo.setName(dmCityReturnCoefficient.getProProductType());
                }


                reportVoReturnList.add(reportVo);
            }

            cityVo.setList(reportVoReturnList);
            listVo.add(cityVo);


        }

        return listVo;
    }
    
    /**
     * 生成城市回款系数分析表数据
     */
    @Transactional
    @Override
    public void refreshDmCityReturnCoefficient(String yearMonth) {
        if (StringUtils.isEmpty(yearMonth)) {
            throw new MsgException(CodeEnum.REQUEST_PARAM_NOT_FULL_ERROR);
        }
        LocalDateTime time = LocalDateTimeUtils.toLocalDateTime(yearMonth).minusMonths(1);
        //删除版本归属时间为传入月份的数据
        dmCityReturnCoefficientMapper.deleteForAffiliationTime(time);

        //获取全路径组织数据列表
        List<FullPathOrgData> fullPathOrgDataListList = projectByStagesService.getFullPathOrgDataListList();
        //获取全部城市编码(key:城市id，value：城市数据)
        Map<String, FullPathOrgData> cityMap = fullPathOrgDataListList.stream().collect(Collectors.toMap(FullPathOrgData::getCityId, s->s,(t1,t2) -> t1));
        //获取项目id列表
        List<MdmProject> projectList = projectService.selectAll();
        //获取全部城市编码(key:城市id，value：项目id集合)
        Map<String, List<MdmProject>> projectIdListByCityIdMap = projectList.stream().collect(Collectors.groupingBy(MdmProject::getCompanyId));
        //获取容差金额
        BigDecimal tolerance = myConstants.getTolerance(SysDictionaryTypeEnum.TOLERACE.getKey());
        //查询全盘最新签约计划版本id列表映射
        Map<String, List<String>> signVersionListMap = signPlanVersionService.getOverallSignVersionListMap();
        //获取全盘供货详情列表映射
        Map<String, List<SignPlanVersionSupplyDetail>> supplyDetailListMap = returnCoefficientDetailService.getSupplyDetailListMap(signVersionListMap);

        List<DmCityReturnCoefficient> cityReturnCoefficientList = new ArrayList<>();
        //循环生成城市回款系数
        for (Map.Entry<String, List<MdmProject>> cityProjectIdListEntry : projectIdListByCityIdMap.entrySet()) {
            //城市标准业态月数回款金额Map
            Map<String, Map<Integer, BigDecimal>> cityProProductMonthAmountMap = new HashMap<>();
            for (MdmProject project : cityProjectIdListEntry.getValue()) {
                //获取项目全盘签约id列表
                List<String> signVersionIdList = signVersionListMap.get(project.getProjectId());
                //获取项目全盘供货详情列表
                List<SignPlanVersionSupplyDetail> supplyDetailList = supplyDetailListMap.get(project.getProjectId());
                if (CollectionUtils.isNotEmpty(signVersionIdList) && CollectionUtils.isNotEmpty(supplyDetailList)) {
                    try {
                        //获取项目标准业态月数回款金额Map(key:标准业态编码:value:(key:月数,value:回款金额))
                        Map<String, Map<Integer, BigDecimal>> projectProProductMonthAmountMap = getProjectProProductMonthAmountMap(project,supplyDetailList,tolerance);
                        mapDataMerge(cityProProductMonthAmountMap,projectProProductMonthAmountMap);
                    }catch (MsgException e){
                        log.error(project.getProjectName()+":"+e.getMsg());
                    }catch (Exception e){
                        log.error(e.getMessage());
                    }
                }
            }

            //获取城市大业态月数回款金额Map
            Map<String, Map<Integer, BigDecimal>>  cityBigProProductMonthAmountMap = getCityBigProProductMonthAmountMap(cityProProductMonthAmountMap);
            mapDataMerge(cityProProductMonthAmountMap,cityBigProProductMonthAmountMap);
            //获取城市回款系数Map
            Map<String, Map<Integer, BigDecimal>> cityReturnCoefficientMap = returnCoefficientDetailService.getProProductMonthCoefficientMap(cityProProductMonthAmountMap);
            //获取城市回款系数列表
            List<DmCityReturnCoefficient> cityReturnCoefficients = getCityReturnCoefficientListByMap(cityReturnCoefficientMap,cityMap.get(cityProjectIdListEntry.getKey()),time);
            cityReturnCoefficientList.addAll(cityReturnCoefficients);
        }

        //保存数据
        dmCityReturnCoefficientMapper.insertList(cityReturnCoefficientList);
    }


    /**
     * 获取城市回款系数列表
     * @param cityReturnCoefficientMap
     * @param cityData
     * @param time
     * @return
     */
    private List<DmCityReturnCoefficient> getCityReturnCoefficientListByMap(Map<String, Map<Integer, BigDecimal>> cityReturnCoefficientMap, FullPathOrgData cityData, LocalDateTime time) {
        List<DmCityReturnCoefficient> cityReturnCoefficientList = new ArrayList<>();

        for (Map.Entry<String, Map<Integer, BigDecimal>> productReturnCoefficientEntry : cityReturnCoefficientMap.entrySet()) {
            DmCityReturnCoefficient coefficientDetail = new DmCityReturnCoefficient();

            //回款系数详情表id
            coefficientDetail.setId(UUIDUtils.create());
            //创建人员
            coefficientDetail.setCreateBy(Constants.SYS);//创建人员
            coefficientDetail.setRegionId(cityData.getRegionId());
            coefficientDetail.setRegionName(cityData.getRegionName());
            //城市id
            coefficientDetail.setCityId(cityData.getCityId());
            //城市名称
            coefficientDetail.setCityName(cityData.getCityName());
            //归属日期
            coefficientDetail.setAffiliationTime(time);
            //创建日期
            coefficientDetail.setCreateTime(LocalDateTime.now());
            //是否删除
            coefficientDetail.setIsDelete(0);
            //业态编码
            coefficientDetail.setProProductCode(productReturnCoefficientEntry.getKey());
            //业态名称
            coefficientDetail.setProProductType(StandardFormatsEnum.getValueByKey(productReturnCoefficientEntry.getKey()) == null
                    ? BigStandardFormatsEnum.getValueByKey(productReturnCoefficientEntry.getKey())
                    : StandardFormatsEnum.getValueByKey(productReturnCoefficientEntry.getKey()));

            //每月回款系数
            Map<Integer, BigDecimal> map = productReturnCoefficientEntry.getValue();
            coefficientDetail.setOneMonth(map.get(1));
            coefficientDetail.setTwoMonth(map.get(2));
            coefficientDetail.setThreeMonth(map.get(3));
            coefficientDetail.setFourMonth(map.get(4));
            coefficientDetail.setFiveMonth(map.get(5));
            coefficientDetail.setSixMonth(map.get(6));
            coefficientDetail.setSevenMonth(map.get(7));
            coefficientDetail.setEightMonth(map.get(8));
            coefficientDetail.setNineMonth(map.get(9));
            coefficientDetail.setTenMonth(map.get(10));
            coefficientDetail.setElevenMonth(map.get(11));
            coefficientDetail.setTwelveMonth(map.get(12));
            coefficientDetail.setThirteenMonth(map.get(13));
            coefficientDetail.setFourteenMonth(map.get(14));
            coefficientDetail.setFifteenMonth(map.get(15));
            coefficientDetail.setSixteenMonth(map.get(16));
            coefficientDetail.setSeventeenMonth(map.get(17));
            coefficientDetail.setEighteenMonth(map.get(18));
            coefficientDetail.setNineteenMonth(map.get(19));
            coefficientDetail.setTwentyMonth(map.get(20));
            coefficientDetail.setTwentyOneMonth(map.get(21));
            coefficientDetail.setTwentyTwoMonth(map.get(22));
            coefficientDetail.setTwentyThreeMonth(map.get(23));
            coefficientDetail.setTwentyFourMonth(map.get(24));
            //初始化第24月系数
            coefficientDetail.initializeTwentyFourMonth();
            cityReturnCoefficientList.add(coefficientDetail);
        }
        return cityReturnCoefficientList;
    }

    /**
     * 获取城市大业态月数回款金额Map
     * @param cityProProductMonthAmountMap
     * @return
     */
    private Map<String, Map<Integer, BigDecimal>> getCityBigProProductMonthAmountMap(Map<String, Map<Integer, BigDecimal>> cityProProductMonthAmountMap) {
        return cityProProductMonthAmountMap.entrySet().stream()
                .collect(Collectors.toMap(s -> StandardFormatsMapEnum.getValueByKey(s.getKey()), Map.Entry::getValue, (s1, s2) -> MyMapUtils.moneyByMonthMapPut(s1, s2)));
    }

    /**
     * map数据合并
     * @param cityProProductMonthAmountMap
     * @param projectProProductMonthAmountMap
     */
    public void mapDataMerge(Map<String, Map<Integer, BigDecimal>> cityProProductMonthAmountMap, Map<String, Map<Integer, BigDecimal>> projectProProductMonthAmountMap){
        for (Map.Entry<String, Map<Integer, BigDecimal>> projectMonthAmountMapEntry : projectProProductMonthAmountMap.entrySet()){
            if(cityProProductMonthAmountMap.containsKey(projectMonthAmountMapEntry.getKey())){
                Map<Integer, BigDecimal> cityMonthAmountMap = cityProProductMonthAmountMap.get(projectMonthAmountMapEntry.getKey());
                Map<Integer, BigDecimal> projectMonthAmountMap = projectMonthAmountMapEntry.getValue();

                for (Map.Entry<Integer, BigDecimal> projectMonthAmountEntry : projectMonthAmountMap.entrySet()){
                    if(cityMonthAmountMap.containsKey(projectMonthAmountEntry.getKey())){
                        cityMonthAmountMap.put(projectMonthAmountEntry.getKey(),cityMonthAmountMap.get(projectMonthAmountEntry.getKey()).add(projectMonthAmountEntry.getValue()));
                    }else {
                        cityMonthAmountMap.put(projectMonthAmountEntry.getKey(),projectMonthAmountEntry.getValue());
                    }
                }
            }else {
                cityProProductMonthAmountMap.put(projectMonthAmountMapEntry.getKey(),projectMonthAmountMapEntry.getValue());
            }
        }
    }


    /**
     * 获取项目标准业态月数回款金额Map
     * @param project
     * @param supplyDetailList
     * @param tolerance
     * @return
     */
    private Map<String, Map<Integer, BigDecimal>> getProjectProProductMonthAmountMap(MdmProject project, List<SignPlanVersionSupplyDetail> supplyDetailList, BigDecimal tolerance) {
        //获取楼栋id列表
        List<String> buildList = supplyDetailList.stream().map(SignPlanVersionSupplyDetail::getOrgId).collect(Collectors.toList());
        //获取项目销售取数系统
        String fetchSys = returnCoefficientDetailService.getProjectSaleFetchSys(project.getProjectId());
        if (FetchNnumberEnum.MY.getKey().equals(fetchSys)) {
            //获取合同列表
            List<MymContractDto> contractList = dmOdsMyVsMarsSContractService.selectMymContractListOfActivate(buildList);
            if (CollectionUtils.isEmpty(contractList)) {
                throw new MsgException(CodeEnum.CREATE_COEFFICIENT_CONTRACT_IS_NULL_ERROR);
            }
            //获取应收列表
            List<VsMarsFeeDto> receivableList = vsMarsFeeService.selectByProjectId(project.getProjectId());
            //获取实收列表
            List<VsMarsGetinzcl> receiptsList = vsMarsGetinzclService.selectByKingdeeProjectId(project.getKingdeeProjectId());

            //回款系数明源销售相关数据初始化
            ReturnCoefficientMySaleDataBO mySaleDataBO = new ReturnCoefficientMySaleDataBO();
            mySaleDataBO.setSupplyDetailList(supplyDetailList);
            mySaleDataBO.setContractList(contractList);
            mySaleDataBO.setReceivableList(receivableList);
            mySaleDataBO.setReceiptsList(receiptsList);
            mySaleDataBO.setTolerance(tolerance);
            mySaleDataBO.initializeMap();

            //获取合同id列表Map（key：标准业态编码，value：合同id列表）
            Map<String, List<String>> contractGUIDListByProProductCodeMap = mySaleDataBO.getContractGUIDListByProProductCodeMap();
            //获取合同月数回款金额Map(key:合同id:value:(key:月数,value:回款金额))
            Map<String, Map<Integer, BigDecimal>> contractMonthAmountMap = returnCoefficientDetailService.getContractMonthAmountMap(mySaleDataBO);
            //获取标准业态月数回款金额Map(key:标准业态编码:value:(key:月数,value:回款金额))
            return returnCoefficientDetailService.getProProductMonthAmountMap(contractMonthAmountMap,contractGUIDListByProProductCodeMap);
        }
        /*else if(FetchNnumberEnum.NOS.getKey().equals(fetchSys)){
            //获取合同列表
            List<NosTradedataDto> roomList = dmOdsNosTradedataviewformarsService.selectNosContractList(buildList);
            if (CollectionUtils.isEmpty(roomList)) {
                throw new MsgException(CodeEnum.CREATE_COEFFICIENT_CONTRACT_IS_NULL_ERROR);
            }
            //获取实收列表
            List<VsNosGetin> receiptsList = vsNosPayabledataviewformarsService.selectByProjectId(project.getProjectId());

            //回款系数NOS销售相关数据初始化
            ReturnCoefficientNosSaleDataBO nosSaleDataBO = new ReturnCoefficientNosSaleDataBO();
            nosSaleDataBO.setSupplyDetailList(supplyDetailList);
            nosSaleDataBO.setRoomList(roomList);
            nosSaleDataBO.setReceiptsList(receiptsList);
            nosSaleDataBO.setTolerance(tolerance);
            nosSaleDataBO.initializeMap();

            //获取房间id列表Map（key：标准业态编码，value：房间id列表）
            Map<String, List<String>> roomIdListByProProductCodeMap = nosSaleDataBO.getTakeBackRoomIdListByProProductCodeMap();
            //获取房间月数回款金额Map(key:房间id:value:(key:月数,value:回款金额))
            Map<String, Map<Integer, BigDecimal>> roomMonthAmountMap = returnCoefficientDetailService.getRoomMonthAmountMap(nosSaleDataBO);
            //获取标准业态月数回款金额Map(key:标准业态编码:value:(key:月数,value:回款金额))
            return returnCoefficientDetailService.getProProductMonthAmountMap(roomMonthAmountMap,roomIdListByProProductCodeMap);
        }
        */
        return null;
    }

}
